﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MediatR;
using Ecommerce.Domain.Eunm;
using Ecommerce.API.Application.Command.Eunmcommand;
using Ecommerce.Services.Eunm;
using System.Security.Cryptography;
using Ecommerce.Repository.Impl.Use;
using Microsoft.AspNetCore.Authorization;

namespace Ecommerce.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class EunmController : ControllerBase
    {
        private readonly IMediator mediator;

        private readonly IEunmServices services;

        public EunmController(IMediator mediator, IEunmServices services)
        {
            this.mediator = mediator;
            this.services = services;
        }

        /// <summary>
        /// 枚举列表1213456789023456789
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<object> Eunmlist(EunmlistCommand command)
        {
            return await mediator.Send(command);
        }
        [HttpPost]
        public async Task<int> UpdateEunm(EunmUpdateCommand eunmUpdate)
        {
            return await mediator.Send(eunmUpdate);
        }
        [HttpPost]
        public async Task<List<Meunm>> GetMeunms(EunmGetCommand eunm)
        {
            return await mediator.Send(eunm);
        }
        [HttpPost]
        public async Task<int> GetMeun(int Eid)
        {
            return await services.GetMeun(Eid);
        
        }
        [HttpGet]
        public async Task<object> GetRoles()
        {
            return await services.GetRoles();
        }
    }
}
